package com.kkb.study;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

public class Stream {
    public static void main(String[] args) {
        test1();
    }
    public static void test1(){
        List<Integer> list = Arrays.asList(1,2,3,4,5);
        list.stream().filter(item -> {
            return item >= 3;
        }).forEach(item -> {
            System.out.println(item);
            System.out.println(Thread.currentThread().getName());
        });
    }
    public static void test2(){
        List<Integer> list = Arrays.asList(1,2,3,4,5);
        list.parallelStream().filter(item -> {
            return item >= 3;
        }).forEach(item -> {
            System.out.println(item);
            System.out.println(Thread.currentThread().getName());
        });
    }
}
